const path=require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports={
    mode:"development",
    entry:"./src/index.js",
    output:{
        path:path.resolve(__dirname,'./dist'),
        filename:"main.js",
        clean:true,
    },
    module:{
        rules: [
            {
              test: /\.(png|jpg|gif|jpeg)$/,
              use: [
                {
                  loader: 'url-loader',
                  options: {
                    limit: 8192
                  }
                }
              ]
            },
            {
                test: /\.(png|jpeg|gif|jpg)$/i,
                use: [
                  {
                    loader: 'file-loader',
                  },
                ],
            },
            {
                test: /\.css$/i,
                use: ["style-loader", "css-loader"],
            },
          ]
    },
    plugins: [new HtmlWebpackPlugin({
        template:"./index.html",
    })],
    devServer:{
        hot:true,
        open:true,
        static: {
            directory: path.join(__dirname, './dist'),
        },
    }
}